﻿
@{
    ViewBag.Title = "LevelOne";
    Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
}

<table style="width:98%" class="formtable">
    <tbody>
        <tr>
            <td>
                <div class="easyui-panel" style="padding:0px;width:100%">
                    <iframe id="ifLineStack2" src="" style="width:100%; height:250px;" frameborder="0"></iframe>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="hr"></div>
                <div title="来煤统计信息" class="easyui-panel" style="padding:0px;width:100%">
                    <table id="StatList" style="width:100%"></table>
                </div>
            </td>
        </tr>
    </tbody>
</table>
<script type="text/javascript">
    function QueryStatReport(MATERIEL_ID,SUPPLIER_ID,TRANSPORT_ID){
        $("#ifLineStack2").attr("src","@Url.Action("LineStack2", "Home")?MATERIEL_ID="+MATERIEL_ID
            +"&SUPPLIER_ID="+SUPPLIER_ID
            +"&TRANSPORT_ID="+TRANSPORT_ID
            +"&QueryYear=@ViewBag.QueryYear&QueryMonth=@ViewBag.QueryMonth");
    }
    $(function () {
        $('#StatList').datagrid({
            url: '@Url.Action("QueryRCPlanWeighting")',
            width:SetGridWidthSub(35),
            methord: 'post',
            height: SetGridHeightSub(300),
            fitColumns: true,
            sortName: 'SUPPLIER_ID',
            sortOrder: 'desc',
            idField: 'SUPPLIER_ID',
            pagination: false,
            striped: true, //奇偶行是否区分
            singleSelect: true,//单选模式
            onLoadSuccess: function(data) {
                //默认选中第一行
                //var rows = $('#StatList').datagrid('getRows');
                //if (rows != null && rows.length > 0) {
                //    $('#StatList').datagrid('selectRow', 0);

                //    QueryStatReport(rows[0].MATERIEL_ID,rows[0].SUPPLIER_ID,rows[0].TRANSPORT_ID);
                //}
            },
            columns: [[
                //{ field: 'BATCH_CODE', title: '批次编码', width: 80 },
                //{ field: 'PLAN_DATE', title: '计划日期', width: 100,formatter:DateTimeFormatterToDate },
                { field: 'SUPPLIER_ID', title: '供应商', width: 220,hidden:true  },
                { field: 'TRANSPORT_ID', title: '运输商', width: 220,hidden:true },
                { field: 'MATERIEL_ID', title: '物料名称', width: 100,hidden:true },
                { field: 'SUPPLIER_NAME', title: '供应商', width: 220 },
                { field: 'TRANSPORT_NAME', title: '运输商', width: 220 },
                { field: 'MATERIEL_NAME', title: '物料名称', width: 100 },
                { field: 'CUTBILL', title: '车数', width: 80},
                { field: 'BILL_WEIGHT', title: '矿发量', width: 80},
                { field: 'BALANCE', title: '验收量', width: 80 }
            ]]
             , onClickRow: function (index, row) {
                 if (row != null) {
                     QueryStatReport(row.MATERIEL_ID,row.SUPPLIER_ID,row.TRANSPORT_ID);
                 }
             }
        });

        $("#StatList").datagrid('load', {
            QueryYear: @Html.Raw(ViewBag.QueryYear),
            QueryMonth: @Html.Raw(ViewBag.QueryMonth),
            Day: @Html.Raw(ViewBag.Day)
            });

        QueryStatReport("","","");
    });
</script>
